package com.fan.analysis.module.preprocessing.call.controller;

import com.fan.analysis.common.domain.ResponseDTO;
import com.fan.analysis.module.preprocessing.call.domain.vo.CallRecordInCompleteVo;
import com.fan.analysis.module.preprocessing.call.service.CallService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 通话记录控制器
 *
 * @author fan
 * @date 2021/09/20 12:56
 **/
@RestController
@Slf4j
public class CallController {

    @Autowired
    private CallService callService;

    @ApiOperation("原始通话数据-通话记录导入 @author fan")
    @PostMapping(value = "/preprocessed/completing_call_record_data")
    public ResponseDTO<List<CallRecordInCompleteVo>> completingCallRecordData() {
        log.info("原始通话数据-通话记录导入");
        Integer number = 20;
        return callService.completingCallRecordData(number);
    }

    @ApiOperation(value = "通过id获取某一条通话记录", notes = "通过id获取某一条通话记录")
    @GetMapping("/preprocessed/getInfo/{id}")
    public ResponseDTO<CallRecordInCompleteVo> getInfo(@PathVariable Long id) {

        return callService.getInfoById(id);
    }

    @ApiOperation(value = "获取所有的通话记录", notes = "获取所有的通话记录")
    @GetMapping("/preprocessed/getInfoAll")
    public ResponseDTO<List<CallRecordInCompleteVo>> getInfoAll() {

        return callService.listAll();
    }

}
